package com.tedu.egweibo.common.exception;

import com.tedu.egweibo.common.resulf.JsonResult;
import com.tedu.egweibo.common.resulf.StatusCode;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {
    @ExceptionHandler
    public JsonResult doHandRuntimeException(RuntimeException e)
    {
        log.error("服务器发生异常",e);
        System.out.println("处理RuntimeException");
        return new JsonResult(StatusCode.OPERATION_FAILED);
    }

}
